<template>
  <div class="edit-bar">
    <div class="top">
      <label>{{ label }}</label>
      <van-icon v-if="canEdit" name="edit" color="blue" @click="edit" />
    </div>
    <slot></slot>
    <div v-if="name" class="bottom">
      <div class="left">
        <span>{{ name[0] }}</span>
        <label>{{ name }}</label>
      </div>
      <div class="right">
        <van-icon v-if="canRemove" name="delete" color="red" @click="remove" />
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    label: { type: String, default: '' },
    name: { type: String, default: '' },
    canEdit: { type: Boolean, default: false },
    canRemove: { type: Boolean, default: false },
  },
  data() {
    return {}
  },
  computed: {},
  watch: {},
  created() {
  },
  mounted() {
  },
  methods: {
    edit() {
      this.$emit('edit')
    },

    remove() {
      this.$emit('remove')
    },
  },
}
</script>

<style lang="less" scoped>
.edit-bar{
  .top{
    padding: 12px 16px;
    background: #E1EEFF;
    display: flex;
    justify-content: space-between;
    align-items: center;
    label{
      font-size: 14px;
      font-weight: 600;
    }

  }
  .bottom{
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    .left{
      font-size: 14px;
      display: flex;
      justify-content: flex-start;
      align-items: center;
      span{
        border-radius: 50%;
        background: #1F87FC;
        width: 20px;
        height: 20px;
        color: #fff;
        display: flex;
        justify-content: center;
        align-items: center;
      }
      label{
        margin-left: 4px;
      }
    }
    .right{

    }
  }
}
</style>
